//
// Created by Administrator on 2021/11/25.
// May Saint Diana bless you!
//
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <climits>

using namespace std;

class Solution {
public:

    bool isRectangleOverlap(vector<int> &rec1, vector<int> &rec2) {
        // 有没有面积为0的
        if (rec1[0] == rec1[2] || rec1[1] == rec1[3] || rec2[0] == rec2[2] || rec2[1] == rec2[3]) {
            return false;
        }
        // 排除掉不相交的
        return !(rec1[2] <= rec2[0] ||   // left
                 rec1[3] <= rec2[1] ||   // bottom
                 rec1[0] >= rec2[2] ||   // right
                 rec1[1] >= rec2[3]);    // top
    }

};

int main() {
    vector<int> rec1{0, 0, 2, 2};
    vector<int> rec2{1, 1, 3, 3};
    Solution solution;
    cout << solution.isRectangleOverlap(rec1, rec2) << endl;
    return 0;
}
